﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BooksManager
{
    public partial class admin22 : Form
    {
        string ID = "";
        public admin22()
        {
            InitializeComponent();
        }

        public admin22(string id, string name, string author, string publish, string amount)
        {
            InitializeComponent();
            ID = textBox_id.Text = id;
            textBox_name.Text = name;
            textBox_author.Text = author;
            textBox_publish.Text = publish;
            textBox_amount.Text = amount;
        }

        private void button_add_Click(object sender, EventArgs e)
        {
            string sql = $"update t_books set id = '{textBox_id.Text}',[name] = '{textBox_name.Text}'," +
                $"author = '{textBox_author.Text}',press = '{textBox_publish.Text}', number = {textBox_amount.Text} where id = '{ID}'";
            Dao dao = new Dao();
            if (dao.Execute(sql) > 0)
            {
                MessageBox.Show("修改成功");
                this.Close();
            }
        }
    }
}
